-- GENERATED SPELL FOR [Varimathras] --


function spell0_31565(pUnit, Event) --@Carrion Swarm,n/a--
pUnit:FullCastSpellOnTarget(59434,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_31565', 20000, 1)
end

function spell1_31565(pUnit, Event) --@Drain Life,Drain--
pUnit:FullCastSpellOnTarget(17238,pUnit:GetRandomPlayer(0))
pUnit:RegisterEvent('Sorts_31565', 5000, 1)
end

function spell2_31565(pUnit, Event) --@Might of Varimathras,Self--
pUnit:FullCastSpellOnTarget(59424,pUnit)
pUnit:RegisterEvent('Sorts_31565', 652, 1)
end

function spell3_31565(pUnit, Event) --@Shadow Bolt Volley,n/a--
pUnit:FullCastSpellOnTarget(20741,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_31565', 535, 1)
end

function spell4_31565(pUnit, Event) --@Shadow Nova,Self--
pUnit:FullCastSpellOnTarget(59435,pUnit)
pUnit:RegisterEvent('Sorts_31565', 4000, 1)
end

function spell5_31565(pUnit, Event) --@Summoned Demon,Self--
pUnit:FullCastSpellOnTarget(7741,pUnit)
pUnit:RegisterEvent('Sorts_31565', 667, 1)
end

function Sorts_31565(pUnit, Event)
local choix_sorts_31565 = math.random(0, 5)
if choix_sorts_31565 == 0 then
pUnit:RegisterEvent('spell0_31565', 1, 1)
end
if choix_sorts_31565 == 1 then
pUnit:RegisterEvent('spell1_31565', 1, 1)
end
if choix_sorts_31565 == 2 then
pUnit:RegisterEvent('spell2_31565', 1, 1)
end
if choix_sorts_31565 == 3 then
pUnit:RegisterEvent('spell3_31565', 1, 1)
end
if choix_sorts_31565 == 4 then
pUnit:RegisterEvent('spell4_31565', 1, 1)
end
if choix_sorts_31565 == 5 then
pUnit:RegisterEvent('spell5_31565', 1, 1)
end
end

function mob31565_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_31565', math.random(1500, 3000), 1)
end

function mob31565_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob31565_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob31565_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(31565, 1, 'mob31565_Action')
RegisterUnitEvent(31565, 2, 'mob31565_Leave')
RegisterUnitEvent(31565, 3, 'mob31565_Kill')
RegisterUnitEvent(31565, 4, 'mob31565_Die')
